<%@ include file="/common/taglibs.jsp"%>
<%@ taglib prefix="other" tagdir="/WEB-INF/tags/other"%>
<%@ taglib prefix="system" tagdir="/WEB-INF/tags/system"%>

<form class="mainForm" name="customerListForm" method="post" id="customerListForm" action="${ctxPath}/customer/customer.html">
	<c:set var="editURLPath"	value="/customer/customer.html?doAction=edit&from=list" scope="page" />
	<div class="top clearfix">
		<ul class="tab">
			<li class="curr"><span><fmt:message key="menu.customerList"/></span></li>
		</ul>
		<%@include file="/common/pagingOnlyTop.jsp"%>
	</div>
	<div class="data">		
		<c:set var="checkAll">
			<input type="checkbox" name="allbox" onclick="checkAll(this.form)"	class="checkbox" />
		</c:set>
		<c:set var="isNeedTopPaging" value="true"/>
		
		<table width="100%" border="0" cellspacing="0" cellpadding="0" class="list_table" id="customerTable" style="table-layout:fixed;">	
			<tr>
			  	<th width="20"><input onclick="checkAll(this.form)" name="allbox" type="checkbox" value="" /></th>	
				<th style="width:20px;">
					<span class="expand" onclick="toggleScreenAll(this)">&nbsp;</span>
				</th>
				<th style="width:10%" class='sortable ${(customerSearchCriteria.orderby eq 7)?"sorted order1":((customerSearchCriteria.orderby eq 8)?"sorted order2":"")}'>
					<a onclick="sortField(this,7,8)"><fmt:message key="customer.username" /></a>
				</th>
				<th>
					<span><fmt:message key="tags.name" /></span>
				</th> 
				<th style="width:10%" class='sortable ${(customerSearchCriteria.orderby eq 3)?"sorted order1":((customerSearchCriteria.orderby eq 4)?"sorted order2":"")}'>
					<a onclick="sortField(this,3,4)"><fmt:message key="customer.fullname" /></a>
				</th>
				<th  style="width:15%" class='sortable ${(customerSearchCriteria.orderby eq 9)?"sorted order1":((customerSearchCriteria.orderby eq 10)?"sorted order2":"")}'>
					<a onclick="sortField(this,9,10)"><fmt:message key="customer.email" /></a>
				</th>
				<th  style="width:10%" class='sortable ${(customerSearchCriteria.orderby eq 1)?"sorted order1":((customerSearchCriteria.orderby eq 2)?"sorted order2":"")}'>
					<a onclick="sortField(this,1,2)"><fmt:message key="customer.registerTime" /></a>
				</th>
				<th  style="width:5%" class='sortable ${(customerSearchCriteria.orderby eq 11)?"sorted order1":((customerSearchCriteria.orderby eq 12)?"sorted order2":"")}'>
					<a onclick="sortField(this,11,12)"><fmt:message key="appUser.status" /></a>
				</th>
				<th  style="width:10%">
					<span><fmt:message key="appUser.createBy" /></span>
				</th>
				<th  style="width:10%">
					<span><fmt:message key="public.management" /></span>
				</th>
			</tr>
			<c:forEach var="customer" items="${customerList}" varStatus="status">
				<tr id="tr${customer.appuserId}" class="${(status.index%2==0)?'even':'odd'}">
					<td>
						<common:htmlEscape value="${customer.tagNames}" returnValue="tagNames"/>
	    				<input email="${customer.email}" phone="${customer.mobilephone}" customerId="${customer.customerId}" type="checkbox" id="multiIds_${customer.appuserId}" name="multiIds" value="${customer.appuserId}" title="${customer.username}" class="checkbox" tags="${tagNames}"/>
					</td>
					<td>
						 <span class="expand toggleScreen" onclick="toggleScreen(this)">&nbsp;</span>                    
					</td>
					<td>
						<a href="javascript:void(0)" onclick="parent.editCustomer(${customer.appuserId})">
							${customer.username}
						</a>	
					</td>
					<td>
						<c:forEach items="${customer.tagNameArray}" var="tagName">
							<b title="${tagName}" class="tag"><common:displayString value="${tagName}" length="5"/></b>
						</c:forEach>
					</td>
					<td>
						${customer.firstname}
					</td>
					<td>
						${customer.email}
					</td>
					<td>
						<fmt:formatDate value="${customer.createTime}" pattern="yyyy-MM-dd" />
					</td>
					<td>
						<c:choose>
							<c:when test="${customer.status==1}">
								<fmt:message key="customer.status.active"/>
							</c:when>
							<c:otherwise>
								<font color="red"><fmt:message key="customer.status.inactive"/></font>
							</c:otherwise>
						</c:choose>
					</td>
					<td>
						<system:operatorUserName userId="${customer.createBy}" />
					</td>
					<td>
						<authorize:authorizeResource resourceString="/customer/customer/blank.html?doAction=saveResetPassword*">
							<span class="resetPw"></span><a href="javascript:dlgresetPasswordDialog_show({appuserId:${customer.appuserId}})"><fmt:message key="customer.tab.resetPassword"/></a>
						</authorize:authorizeResource>
					</td>
				</tr>
				<tr style="display: none;" class="${(status.index%2==0)?'even':'odd'}  sub">
					<td></td>
					<td class="consignee" colspan="10">
						<div class="order_show">
							<table cellspacing="0" cellpadding="0" border="0" width="100%">
								<tr>
									<td>
										<table cellspacing="0" cellpadding="0" border="0" width="100%" class="consignee_table">
											<tr>
												<th width="100px;"><fmt:message key="customer.membership"/>:</th>
												<td>${customer.membership.membershipName}</td>
											</tr>
											<tr>
												<th><fmt:message key="customer.shopPoint.total"/>:</th>
												<td>${customer.shopPoint.total}</td>
											</tr>
											<tr>
												<th><fmt:message key="customer.shopPoint.gainedTotal"/>:</th>
												<td>${customer.shopPoint.gainedTotal}</td>
											</tr>
											<tr>
												<th><fmt:message key="customer.shopPoint.usedTotal"/>:</th>
												<td>${customer.shopPoint.usedTotal}</td>
											</tr>
										</table>
									</td>
									<td>
										<table cellspacing="0" cellpadding="0" border="0" width="100%" class="consignee_table">
											<tr>
												<th width="100px;"><fmt:message key="customer.gender"/>:</th>
												<td><fmt:message key="customer.gender.${customer.gender}"/></td>
											</tr>
											<tr>
												<th><fmt:message key="customer.telephone"/>:</th>
												<td>${customer.telephone}&nbsp;</td>
											</tr>
											<tr>
												<th ><fmt:message key="customer.fax"/>:</th>
												<td>${customer.fax}&nbsp;</td>
											</tr>
											<tr>
												<th ><fmt:message key="customer.zip"/>:</th>
												<td>${customer.zip}&nbsp;</td>
											</tr>
										</table>
									</td>
									<td>
										<table cellspacing="0" cellpadding="0" border="0" width="100%" class="consignee_table">
											<tr>
												<th width="100px;"><fmt:message key="customer.registerTime"/>:</th>
												<td><fmt:formatDate value="${customer.createTime}" pattern="yyyy-MM-dd HH:mm" />&nbsp;</td>
											</tr>
											<tr>
												<th ><fmt:message key="customer.remoteIp"/>:</th>
												<td>${customer.remoteIp}&nbsp;</td>
											</tr>
											<tr>
												<th ><fmt:message key="customer.address"/>:</th>
												<td>${customer.address}&nbsp;</td>
											</tr>
											<tr>
												<th ><fmt:message key="customer.lastLoginTime"/>:</th>
												<td><fmt:formatDate value="${customer.lastLoginTime}" pattern="yyyy-MM-dd HH:mm" />&nbsp;</td>
											</tr>
										</table>
									</td>
								</tr>
							</table>
						</div>
					</td>
				</tr>	
			</c:forEach>
			<c:if test="${empty customerList}">
				<tr>
					<td colspan="10" style="text-align:center">
						<fmt:message key="customerList.empty"/>
					</td>
				</tr>
			</c:if>
		</table>	
		<%@include file="/common/pagingOnly.jsp" %>
	</div>
</form>

<%--------保存查询条件 -------%>
<%@include file="customerSearchCriteriaStorage.jspf"%>

<script type="text/javascript">
$j(document).ready(function () {
	highlightTableRows("customerTable");
});
</script>
